package com.yuexun.dhdoctor.module.my.ui;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.yuexun.dhdoctor.R;
import com.yuexun.dhdoctor.base.BaseKJActivity;
import com.yuexun.dhdoctor.config.AppConfig;

import org.kymjs.kjframe.utils.PreferenceHelper;

import butterknife.Bind;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2017/4/26 0026.
 */

public class Act_Qrcode extends BaseKJActivity {


    @Bind(R.id.qrcode_view)
    ImageView qrcodeView;
    @Bind(R.id.txt_view)
    TextView txtView;

    String qrcodeUrl;

    @Override
    public void setRootView() {
        setContentView(R.layout.act_qrcode);
        ButterKnife.bind(this);
    }

    @Override
    public void initData() {
        super.initData();
        txtView.setText("没有二维码");
        if(PreferenceHelper.readString(aty, AppConfig.USER_INFO, AppConfig.JOB_ID) != null &&
                !PreferenceHelper.readString(aty, AppConfig.USER_INFO, AppConfig.JOB_ID).isEmpty()){
            qrcodeUrl = AppConfig.WEB_ROOT + "data/personal/" +
                    PreferenceHelper.readString(aty, AppConfig.USER_INFO, AppConfig.JOB_ID) + ".png";

            Glide.with(aty).load(qrcodeUrl).into(qrcodeView);
        }else{
            qrcodeView.setVisibility(View.GONE);
            txtView.setVisibility(View.VISIBLE);
            txtView.setText("没有二维码");
        }
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
    }

    @OnClick(R.id.back)
    public void onClick() {
        finish();
    }
}
